'use strict';
/**
 * @description 判断url的参数是否正确
 * */
module.exports = (key = 'id') => {
  return async (ctx, next) => {
    const val = ctx.params[key];
    if (/^\d+$/.test(val)) {
      await next();
    } else {
      ctx.body = {
        status: 500,
        message: '参数错误',
      };
    }
  };
};
